﻿<UserControl x:Class="Guitar.CustomControls.NumericUpDown"
			 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
			 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
			 xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
			 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
			 mc:Ignorable="d" d:DesignWidth="50" d:DesignHeight="20"
			 Background="White">
	
	<UserControl.Resources>	


	  <LinearGradientBrush x:Key="NormalBrush" StartPoint="0,0" EndPoint="0,1">
	    <GradientBrush.GradientStops>
	      <GradientStopCollection>
	        <GradientStop Color="#FFF" Offset="0.0"/>
	        <GradientStop Color="#CCC" Offset="1.0"/>
	      </GradientStopCollection>
	    </GradientBrush.GradientStops>
	  </LinearGradientBrush>

	  <LinearGradientBrush x:Key="HorizontalNormalBrush" StartPoint="0,0" EndPoint="1,0">
	    <GradientBrush.GradientStops>
	      <GradientStopCollection>
	        <GradientStop Color="#FFF" Offset="0.0"/>
	        <GradientStop Color="#CCC" Offset="1.0"/>
	      </GradientStopCollection>
	    </GradientBrush.GradientStops>
	  </LinearGradientBrush>

	  <LinearGradientBrush x:Key="LightBrush" StartPoint="0,0" EndPoint="0,1">
	    <GradientBrush.GradientStops>
	      <GradientStopCollection>
	        <GradientStop Color="#FFF" Offset="0.0"/>
	        <GradientStop Color="#EEE" Offset="1.0"/>
	      </GradientStopCollection>
	    </GradientBrush.GradientStops>
	  </LinearGradientBrush>

	  <LinearGradientBrush x:Key="HorizontalLightBrush" StartPoint="0,0" EndPoint="1,0">
	    <GradientBrush.GradientStops>
	      <GradientStopCollection>
	        <GradientStop Color="#FFF" Offset="0.0"/>
	        <GradientStop Color="#EEE" Offset="1.0"/>
	      </GradientStopCollection>
	    </GradientBrush.GradientStops>
	  </LinearGradientBrush>

	  <LinearGradientBrush x:Key="DarkBrush" StartPoint="0,0" EndPoint="0,1">
	    <GradientBrush.GradientStops>
	      <GradientStopCollection>
	        <GradientStop Color="#FFF" Offset="0.0"/>
	        <GradientStop Color="#AAA" Offset="1.0"/>
	      </GradientStopCollection>
	    </GradientBrush.GradientStops>
	  </LinearGradientBrush>

	  <LinearGradientBrush x:Key="PressedBrush" StartPoint="0,0" EndPoint="0,1">
	    <GradientBrush.GradientStops>
	      <GradientStopCollection>
	        <GradientStop Color="#BBB" Offset="0.0"/>
	        <GradientStop Color="#EEE" Offset="0.1"/>
	        <GradientStop Color="#EEE" Offset="0.9"/>
	        <GradientStop Color="#FFF" Offset="1.0"/>
	      </GradientStopCollection>
	    </GradientBrush.GradientStops>
	  </LinearGradientBrush>

	  <SolidColorBrush x:Key="DisabledForegroundBrush" Color="#888" />

	  <SolidColorBrush x:Key="DisabledBackgroundBrush" Color="#EEE" />

	  <SolidColorBrush x:Key="WindowBackgroundBrush" Color="#FFF" />

	  <SolidColorBrush x:Key="SelectedBackgroundBrush" Color="#DDD" />

	  <!-- Border Brushes -->

	  <LinearGradientBrush x:Key="NormalBorderBrush" StartPoint="0,0" EndPoint="0,1">
	    <GradientBrush.GradientStops>
	      <GradientStopCollection>
	        <GradientStop Color="#CCC" Offset="0.0"/>
	        <GradientStop Color="#444" Offset="1.0"/>
	      </GradientStopCollection>
	    </GradientBrush.GradientStops>
	  </LinearGradientBrush>

	  <LinearGradientBrush x:Key="HorizontalNormalBorderBrush" StartPoint="0,0" EndPoint="1,0">
	    <GradientBrush.GradientStops>
	      <GradientStopCollection>
	        <GradientStop Color="#CCC" Offset="0.0"/>
	        <GradientStop Color="#444" Offset="1.0"/>
	      </GradientStopCollection>
	    </GradientBrush.GradientStops>
	  </LinearGradientBrush>

	  <LinearGradientBrush x:Key="DefaultedBorderBrush" StartPoint="0,0" EndPoint="0,1">
	    <GradientBrush.GradientStops>
	      <GradientStopCollection>
	        <GradientStop Color="#777" Offset="0.0"/>
	        <GradientStop Color="#000" Offset="1.0"/>
	      </GradientStopCollection>
	    </GradientBrush.GradientStops>
	  </LinearGradientBrush>

	  <LinearGradientBrush x:Key="PressedBorderBrush" StartPoint="0,0" EndPoint="0,1">
	    <GradientBrush.GradientStops>
	      <GradientStopCollection>
	        <GradientStop Color="#444" Offset="0.0"/>
	        <GradientStop Color="#888" Offset="1.0"/>
	      </GradientStopCollection>
	    </GradientBrush.GradientStops>
	  </LinearGradientBrush>

	  <SolidColorBrush x:Key="DisabledBorderBrush" Color="#AAA" />

	  <SolidColorBrush x:Key="SolidBorderBrush" Color="#888" />

	  <SolidColorBrush x:Key="LightBorderBrush" Color="#AAA" />

	
	  <SolidColorBrush x:Key="GlyphBrush" Color="#444" />

	  <SolidColorBrush x:Key="LightColorBrush" Color="#DDD" />
		
	  <Style x:Key="SpinnerButtonStyle" TargetType="{x:Type Button}">
		  <Setter Property="SnapsToDevicePixels" Value="true"/>
		  <Setter Property="OverridesDefaultStyle" Value="true"/>
		  <Setter Property="Height" Value="10"/>
		  <Setter Property="MinWidth" Value="0"/>
		  <Setter Property="Template">
		    <Setter.Value>
		      <ControlTemplate TargetType="Button">
		        <Border x:Name="Border" CornerRadius="2" BorderThickness="0"
		          		Background="{StaticResource NormalBrush}" BorderBrush="{StaticResource NormalBorderBrush}">
		          <ContentPresenter 
		            Margin="2"
		            HorizontalAlignment="Center"
		            VerticalAlignment="Center"
		            RecognizesAccessKey="True"/>
		        </Border>
		        <ControlTemplate.Triggers>
		          <Trigger Property="IsKeyboardFocused" Value="true">
		            <Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource DefaultedBorderBrush}" />
		          </Trigger>
		          <Trigger Property="IsDefaulted" Value="true">
		            <Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource DefaultedBorderBrush}" />
		          </Trigger>
		          <Trigger Property="IsMouseOver" Value="true">
		            <Setter TargetName="Border" Property="Background" Value="{StaticResource DarkBrush}" />
		          </Trigger>
		          <Trigger Property="IsPressed" Value="true">
		            <Setter TargetName="Border" Property="Background" Value="{StaticResource PressedBrush}" />
		            <Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource PressedBorderBrush}" />
		          </Trigger>
		          <Trigger Property="IsEnabled" Value="false">
		            <Setter TargetName="Border" Property="Background" Value="{StaticResource DisabledBackgroundBrush}" />
		            <Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource DisabledBorderBrush}" />
		            <Setter Property="Foreground" Value="{StaticResource DisabledForegroundBrush}"/>
		          </Trigger>
		        </ControlTemplate.Triggers>
		      </ControlTemplate>
		    </Setter.Value>
		  </Setter>
		</Style>
	</UserControl.Resources>

	<Grid x:Name="LayoutRoot" DataContext="{Binding}">
		<Grid.ColumnDefinitions>
			<ColumnDefinition Width="*" />
			<ColumnDefinition Width="Auto" />
		</Grid.ColumnDefinitions>
		<Grid.RowDefinitions>
			<RowDefinition Height="Auto" />
			<RowDefinition Height="Auto" />
		</Grid.RowDefinitions>
		
		<TextBox Grid.RowSpan="2" Name="textBoxValue"  Grid.Column="0" BorderThickness="0" 
				 VerticalContentAlignment="Center" VerticalAlignment="Stretch"
				 HorizontalContentAlignment="Right" 
				 Text="{Binding Path=Value, Mode=OneWay}" TextChanged="TextBox_TextChanged" />
		
		<Button Grid.Row="0" Grid.Column="1" Style="{StaticResource SpinnerButtonStyle}"
				Click="btUpButton_Click">
			<Path HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
				Fill="#FF333333" Stretch="Uniform" Margin="1,0,1,0"
				Data="F1 M 541.537,173.589L 531.107,173.589L 536.322,167.49L 541.537,173.589 Z " />
		</Button>
		<Button Grid.Row="1" Grid.Column="1" Style="{StaticResource SpinnerButtonStyle}"
				Click="btDownButton_Click">
			<Path HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
				Fill="#FF333333" Stretch="Uniform" Margin="1,0,1,0"
				Data="F1 M 531.107,321.943L 541.537,321.943L 536.322,328.042L 531.107,321.943 Z " />
		</Button>
	</Grid>
</UserControl>